package com.kiln.juxingqs.ui.vm

import android.app.Application
import androidx.lifecycle.MutableLiveData
import client.global.commlib.network.data.JsonResult
import com.kiln.juxingqs.api.bean.WdgzRet
import com.kiln.juxingqs.ui.viewmodel.MiddleVm


class WdgzViewModel(app: Application) : MiddleVm(app) {
    val isShowing = MutableLiveData<Boolean>(false)

    val isOneLoading = MutableLiveData<Boolean>(false)
    val pageOne = MutableLiveData<Int>(0)
    val searchVal = MutableLiveData<String>("")
    val callOne = MutableLiveData<JsonResult<WdgzRet>>()


    fun holdOne() {
        if (isOneLoading.value!!)
            return
        hold({
            server.wdgz(pageOne.value!!, searchVal.value)
        }, {
            isOneLoading.value = true
            pageOne.value = pageOne.value!! + 1
        }, {
            callOne.value = it
        }, complete = {
            isOneLoading.value = false
        })
    }

}